import request from "../utils/request";

// 创建预约
export const createBooking = (data: any) =>
    request.post("/api/booking/create", data)

// 获取我的预约列表
export const getMyBookings = (params: any) =>
    request.get("/api/booking/my", { params })

// 修改预约
export const updateBooking = (id: number, data: any) =>
    request.put(`/api/booking/${id}`, data)

// 取消预约
export const cancelBooking = (id: number) =>
    request.delete(`/api/booking/${id}`)

// 转让预约
export const transferBooking = (id: number, userId: number) =>
    request.post(`/api/booking/${id}/transfer`, { userId })

// 成员端设备保修
export const reportDeviceIssue = (data: any) =>
    request.post("/api/booking/device/report", data);

// 管理员端获取设备保修列表
export const getDeviceReportList = (params: any) =>
    request.get("/api/booking/device/report/list", { params });

// 管理员端处理设备保修
export const handleDeviceReport = (id: number, data: any) =>
    request.put(`/api/booking/device/report/${id}`, data);